﻿namespace MSSqlSchemaDoc.Core.DataStructures
{
    using System.Xml.Serialization;

    /// <summary>
    /// Represents a parameter to a procedure or function.
    /// </summary>
    public class ProcedureParameter
    {
        /// <summary>
        /// Gets or sets the name of the parameter.
        /// </summary>
        [XmlAttribute()]
        public string Name { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether the parameter is an output parameter.
        /// </summary>
        [XmlElement()]
        public bool IsOutputParameter { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether the parameter is a cursor-reference parameter.
        /// </summary>
        [XmlElement()]
        public bool IsCursorReference { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether the value is a complete Xml document.
        /// </summary>
        [XmlElement()]
        public bool IsCompleteXmlDocument { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether the parameter has a default value.
        /// The setting only applies to SQL CLR function or procedures. It will be false for T-SQL functions and procedures.
        /// </summary>
        [XmlElement()]
        public bool HasDefaultValue { get; set; }

        /// <summary>
        /// Gets or sets the default value of the parameter.
        /// </summary>
        [XmlElement()]
        public string DefaultValue { get; set; }

        /// <summary>
        /// Gets or sets the value of the ID of the collection containing the validating XML schema namespace of the parameter.
        /// Non-zero if the data type of the parameter is XML and the XML is typed. Is 0 if there is no XML schema collection.
        /// </summary>
        [XmlElement()]
        public int? XmlCollectionId { get; set; }

        /// <summary>
        /// Gets or sets the data type of the parameter.
        /// </summary>
        [XmlElement()]
        public DataType DataType { get; set; }
    }
}
